<!--
Copyright (C) 2012 Martin Řehánek <rehan at mzk.cz>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<!DOCTYPE html>
<html>
    <head>
        <title>Přehrávač gramodesek</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <!--<link rel="stylesheet" type="text/css" href="css/360player.css"></link>-->
        <!--<link rel="myplayer" type="text/css" href="../css/my_player.css"></link>-->

        <!--<link type="text/css" href="css/my_player.css"></link> -->
        <!--        <link rel="stylesheet" type="text/css" href="http://localhost:8080/ClosureTest/css/audioplayer.css"></link>        
                <link rel="stylesheet" type="text/css" href="http://localhost:8080/ClosureTest/css/playlist.css"></link>-->

        <!--<script src="http://localhost:8080/ClosureTest/js/playerRenderer.js"></script>-->
        <!--<script src="http://localhost:8080/ClosureTest/js-compiled/audioplayer-compiled.js"></script>-->
        <!--        <script src="http://localhost:8080/ClosureTest/soundmanager/script/soundmanager2.js"></script>
                <script src="http://localhost:9810/compile?id=audio&format=RAW"></script> -->
        <!--<script src="js/audioplayer/soundmanager/script/soundmanager2.js"></script>-->
        <script src="js/soundmanager/script/soundmanager2.js"></script>
        <script>
//            tohle zapnout jen kdyz testuju v projektu ClosureTest mimo Krameria
            window['debugMode']=true;
        </script>

        <script src="http://localhost:9810/compile?id=audio&format=RAW"></script> 

    </head>
    <body>
        <script>
            //window.onload = kramerius.audio.run;
            window.onload = function(){
                
                //var audioProxyUrl = 'audioProxy';
                var audioProxyUrl = 'http://localhost:8080/K4AudioPOC/audioProxy';
                var soundplayerFlashUrl = 'js/soundmanager/swf';
                var renderer = new kramerius.audio.Renderer(audioProxyUrl, soundplayerFlashUrl, true);
                //var renderer = new kramerius.audio.Renderer(audioProxyUrl, false);
                renderer.appendCss('css/audioplayer.css', 'audioplayer');
                //                renderer.appendCss('css/playlist.css', 'playlist');
                renderer.appendCss('css/audioplayer-deprecated.css', 'audioplayer-depracated');
                
                
                //takhle se budou pridavat tracky:
                //                renderer.addNewTrack('uuid:STALIN_4-1', 'Stalin 4.1','1:12');
                //                renderer.addNewTrack('uuid:STALIN_4-2', 'Stalin 4.2', '1:35');
                //                renderer.addNewTrack('uuid:STALIN_4-3', 'Stalin 4.3', '1:35');
                
                //'uuid:STALIN_4-3.d', 'Stalin 4.3-local', '1:38'(,'STALIN_4_1.mp3'))
                setTimeout(function(){
                    renderer.addNewTrack('uuid:50dffefd-27fe-40df-1121-2e0d82b770a8','Testovací soubor gramodesek (song No. 1) 1234567890123456789','1:38','true','true','true');
                }, 0);
                setTimeout(function(){
                    renderer.addNewTrack('uuid:50dffefd-27fe-40df-1122-2e0d82b770a8','Testovací soubor gramodesek (song No. 2)','1:38','true','true','true');
                }, 0);
                setTimeout(function(){
                    renderer.addNewTrack('uuid:50dffefd-27fe-40df-1122-2e0d82b770a8','Testovací soubor gramodesek (song No. 2)','1:38','true','true','true');
                }, 0);
                //                setTimeout(function(){
                //                    renderer.addNewTrack('uuid:50dffefd-27fe-40df-1123-2e0d82b770a8','Testovací soubor gramodesek (song No. 3)','1:38','true','true','true');
                //                }, 3000);
                //                setTimeout(function(){
                //                    renderer.addNewTrack('uuid:50dffefd-27fe-40df-1124-2e0d82b770a8','Testovací soubor gramodesek (song No. 4)','1:38','true','true','true');
                //                }, 4000);
                //                setTimeout(function(){
                //                    renderer.addNewTrack('uuid:50dffefd-27fe-40df-1125-2e0d82b770a8','Testovací soubor gramodesek (song No. 5)','1:38','true','true','true');
                //                }, 5000);
                //                setTimeout(function(){
                //                    renderer.addNewTrack('uuid:50dffefd-27fe-40df-1126-2e0d82b770a8','Testovací soubor gramodesek (song No. 6)','1:38','true','true','true');
                //                }, 6000);
                //                setTimeout(function(){
                //                    renderer.addNewTrack('uuid:50dffefd-27fe-40df-1127-2e0d82b770a8','Testovací soubor gramodesek (song No. 7)','1:38','true','true','true');
                //                }, 7000);
                //                setTimeout(function(){
                //                    renderer.addNewTrack('uuid:50dffefd-27fe-40df-1128-2e0d82b770a8','Testovací soubor gramodesek (song No. 8)','1:38','true','true','true');
                //                }, 8000);
                //                setTimeout(function(){
                //                    renderer.addNewTrack('uuid:50dffefd-27fe-40df-1129-2e0d82b770a8','Testovací soubor gramodesek (song No. 9)','1:38','true','true','true');
                //                }, 9000);
                //                setTimeout(function(){
                //                    renderer.addNewTrack('uuid:50dffefd-27fe-40df-1130-2e0d82b770a8','Testovací soubor gramodesek (song No. 10)','1:38','true','true','true');
                //                }, 10000);                
            };
        </script>

        <div id="audio.player" class="player"> 
            <div class="playerBody">

                <!-- buttons PREVIOUS, PLAY/PAUSE, NEXT -->
                <span class="audioButtons" >
                    <span id ="audio.playPreviousBtn" ></span>
                    <span id ="audio.playPauseBtn" ></span>
                    <span id ="audio.playNextBtn" ></span>
                </span>

                <!-- central display with informations and button to show/hide playlist -->
                <div class="audioDisplayPanel">
                    <div id="audio.playingTrackInfo" class="trackInfoContainer unselectable"></div>
                    <div>
                        <span id ="audio.progressInfo" class="progressInfoContainer unselectable" ></span>
                        <span id ="audio.playlistButton"></span>
                    </div>
                </div>

                <!-- volume control -->
                <div class="volumePanel">
                    <div class ="volumeTitle unselectable" >Hlasitost</div>
                    <div>
                        <span id ="audio.muteBtn" ></span>
                        <span id ="audio.volumeSlider" class="volumeSliderContainer"></span>
                    </div>
                </div>

                <!--TODO: remove br-->
                <br>
                <span id ="audio.timeline" class="timelineContainer"></span>
            </div>

            <div id="audio.playlist"></div>
            <img src="img/audioplayer/Record-icon.png" id="record_pic" hidden="hidden"></img>
            <div id="audio.rotatingRecord" class="rotatingRecordDiv"></div>
            <div id="audio.html5Error" class="html5ErrorDiv"></div>
        </div>

        <!--tady je bordel, co zbyl (porad dobre pro testovani)-->
        <div>
            <span id ="audio.stopBtn" ></span>
            Hlasitost:
            <span id ="audio.volumeInfo" class="volumeInfoContainer"></span>
        </div>





        <script type="text/javascript">
            
            //kramerius.audio.renderAudioPlayer();
            //            goog.require('kramerius.audio');
            // console.log("hi");
            //            var renderer = new kramerius.audio.PlayerRenderer();
            //            renderer.renderAudioPlayer();
            //            kramerius.audio.run();
            //kramerius.audio.Renderer.test();
            //Renderer.test();
            
            //            test();
            //            kramerius.audio.test();
            //            kramerius.audio.test();
            //            kramerius.audio.testWithNs();
            //            test();
            
            //kramerius.audio.renderAudioPlayer();
        </script>


        <!--                        <script type="text/javascript">
                                    
                                    //controller
                                    var controller = new kramerius.audio.Controller(true);
                                    
                                    //playlist
                                    var playlistContainer = goog.dom.getElement('audio.playlist');
                                    var playlist= new kramerius.audio.ui.playlist.Playlist(playlistContainer,controller);
                                    
                                    var audioProxyUrl = 'http://localhost:8080/K4AudioPOC/AudioServlet';
                                    var debugTrackBaseUrl = 'http://localhost/gramodesky/STALIN_shellack/';
                                    var trackFactory = new kramerius.audio.TrackFactory(audioProxyUrl, debugTrackBaseUrl);
                                    
                                    var testTrack = trackFactory.createTrack('uuid:STALIN_4-1', 'Stalin 4.1','1:12')
                                    console.log(testTrack);
                                    
                                    var item1 = new kramerius.audio.ui.playlist.Item(trackFactory.createTrack('uuid:STALIN_4-1', 'Stalin 4.1','1:12'));
                                    item1.appendToPlaylist(playlist);
                                    //item1.setStatusActive();
                                    
                                    var item2 = new kramerius.audio.ui.playlist.Item(trackFactory.createTrack('uuid:STALIN_4-2', 'Stalin 4.2', '1:35'));
                                    item2.appendToPlaylist(playlist);
                                    //item2.setStatusSelected();
                                    
                                    var item3 = new kramerius.audio.ui.playlist.Item(trackFactory.createTrack('uuid:STALIN_4-3', 'Stalin 4.3', '1:09'));
                                    item3.appendToPlaylist(playlist); 
                                    
                                    var item4 = new kramerius.audio.ui.playlist.Item(trackFactory.createTrack('uuid:STALIN_4-4', 'Stalin 4.4', '2:53'));
                                    item4.appendToPlaylist(playlist); 
                                    
                                    //debug items
                                    var item5 = new kramerius.audio.ui.playlist.Item(trackFactory.createDebugTrack('uuid:STALIN_4-3.d', 'Stalin 4.3-local', '1:38','STALIN_4_1.mp3', 'ogg/STALIN_4_1.ogg'));
                                    item5.appendToPlaylist(playlist); 
                                    
                                    var item6 = new kramerius.audio.ui.playlist.Item(trackFactory.createDebugTrack('uuid:STALIN_4-4.d', 'Stalin 4.4-local', '1:45','STALIN_4_2.mp3', 'ogg/STALIN_4_2.ogg'));
                                    item6.appendToPlaylist(playlist); 
                                    
                                    var testDebugTrack = trackFactory.createDebugTrack('uuid:STALIN_4-4.d', 'Stalin 4.4-local', '2:53','STALIN_4_2.mp3', 'ogg/STALIN_4_2.ogg');
                                    console.log(testDebugTrack);
                                    
                                    controller.setPlaylist(playlist);
                                                
                                    //player
                                    
                                    //play/pause
                                    var playPauseBtnSpan = goog.dom.getElement('audio.playPauseBtn');
                                    var playPauseButton = new kramerius.audio.ui.PlayPauseButton(playPauseBtnSpan, controller);
                                    
                                    //stop
                                    var stopBtnSpan = goog.dom.getElement('audio.stopBtn');
                                    var stopButton = new kramerius.audio.ui.StopButton(stopBtnSpan, controller);
                                    
                                    //progress bar
                                    var progressBarSpan = goog.dom.getElement('audio.progressBar');
                                    var progressBar = new kramerius.audio.ui.ProgressBar(progressBarSpan, controller);
                                    
                                    //progress bar
                                    var progressInfoSpan = goog.dom.getElement('audio.progressInfo');
                                    var progressInfo = new kramerius.audio.ui.ProgressInfo(progressInfoSpan, controller);
                                    
                                    //playlist hide/show
                                    var playlistButtonSpan = goog.dom.getElement('audio.playlistButton');
                                    var playlistButton = new kramerius.audio.ui.PlaylistShowHideButton(playlistButtonSpan, controller);
                                    
                                    //volume
                                    var volumeBtnSpan = goog.dom.getElement('audio.volumeBtn');
                                    var volumeButton = new kramerius.audio.ui.VolumeButton(volumeBtnSpan, controller);
                                    
                                    //volume slider
                                    var volumeSliderSpan = goog.dom.getElement('audio.volumeSlider');
                                    var volumeSlider = new kramerius.audio.ui.VolumeSlider(volumeSliderSpan, controller);
                                
                                
                                    var audioPlayer = new kramerius.audio.AudioPlayer(controller);
                                    controller.setAudioPlayer(audioPlayer);
                        
                                    
                        
                                    //controller.setTrack(track);
                                    //controller.play();
                                    
                                    //            var containerTest = goog.dom.getElement('containerTest');
                                    //            var container = new kramerius.audio.test.Container(containerTest);
                        
                                    // new kramerius.audio.test.Container(goog.dom.getElement('container1'), "prvni skladba");
                                    // new kramerius.audio.test.Container(goog.dom.getElement('container2'), "druha skladba");
                                    //            new kramerius.audio.test.Container(goog.dom.getElement('container2'), "druha skladba");
                                    //            new kramerius.audio.test.Container(goog.dom.getElement('container3'), "treti skladba");
                                    //            new kramerius.audio.test.Container(goog.dom.getElement('container4'), "ctvrta skladba");
                                    //            new kramerius.audio.test.Container(goog.dom.getElement('container5'), "pata skladba");
                                    
                                    //test control
                                    //var testControlSpan = goog.dom.getElement('testControl');
                                    
                                    //            var btn = new kramerius.audio.test.Button("ahoj");
                                    //            btn.render(testControlSpan);
                                    
                                    //            var trackContainer = new kramerius.audio.ui.playlist.TrackContainer();
                                    //            trackContainer.setTrack(track);
                                    //            trackContainer.render(testControlSpan);
                        
                        
                                    
                                </script>-->
    </body>
</html>
